package com.usian.article.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.usian.article.mapper.ApAuthorMapper;
import com.usian.article.service.ApAuthorService;
import com.usian.model.article.pojos.ApAuthor;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ApAuthorServiceImpl extends ServiceImpl<ApAuthorMapper, ApAuthor> implements ApAuthorService {


    @Override
    public ApAuthor findByUserId(Integer userId) {
        LambdaQueryWrapper<ApAuthor> lambdaQueryWrapper =new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(ApAuthor::getUserId,userId);

        List<ApAuthor> list = list(lambdaQueryWrapper);
        if(list.size()>0){
            return list.get(0);
        }
        return null;
    }
}
